The simple and powerful yfx operator precedence parser
نویسنده
چکیده
machine The parser output is the input of the abstract machine, which outputs the expression value. For example, L{a=*(+(2,2),1) I+(a,a)} results in 8, because a+a=4+4. Some examples of these evaluations are shown below. Let expressions are evaluated using a symbol table, as shown in the examples. In the last example, given the symbol table ’a1b3a2’, (a) occurs twice in the expression. In the most internal scope its value is (a2): evaluate: *(-(2,2),1)@ VALUE=0 evaluate: +(-(1,-[1]),2)@ VALUE=4 evaluate: L{a=*(+(2,2),1)I+(a,a)}@ VALUE=8 tab:a4 evaluate: L{a=*(+(2,2),1)IL{b=1I+(-(b,-[1]),a)}}@ VALUE=6 tab:a4b1 evaluate: L{a=1IL{b=+(2,a)IL{a=+(a,a)I+(a,+(b,1))}}}@ VALUE=6 tab:a1 tab:a1b3 tab:a1b3a2 Copyright c © 2007 John Wiley & Sons, Ltd.
منابع مشابه
Safe Specification of Operator Precedence Rules
In this paper we present an approach to specifying operator precedence based on declarative disambiguation constructs and an implementation mechanism based on grammar rewriting. We identify a problem with existing generalized context-free parsing and disambiguation technology: generating a correct parser for a language such as OCaml using declarative precedence specification is not possible wit...
متن کاملGrammar Engineering Support for Precedence Rule Recovery and Compatibility Checking
A wide range of parser generators are used to generate parsers for programming languages. The grammar formalisms that come with parser generators provide different approaches for defining operator precedence. Some generators (e.g. YACC) support precedence declarations, others require the grammar to be unambiguous, thus encoding the precedence rules. Even if the grammar formalism provides preced...
متن کاملPAPAGENO: A Parallel Parser Generator for Operator Precedence Grammars
In almost all language processing applications, languages are parsed employing classical algorithms (such as the LR(1) parsers generated by Bison), which are sequential due to their left-to-right state-dependent nature. Although early theoretical studies on parallel parsing algorithms delineated potential speedups on abstract parallel machines using a data-parallel approach, practical developme...
متن کاملThe PAPAGENO Parallel-Parser Generator
The increasing use of multicore processors has deeply transformed computing paradigms and applications. The wide availability of multicore systems had an impact also in the field of compiler technology, although the research on deterministic parsing did not prove to be effective in exploiting the architectural advantages, the main impediment being the inherent sequential nature of traditional L...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Softw., Pract. Exper.
دوره 37 شماره
صفحات -
تاریخ انتشار 2007